﻿@model Resto.CostControl.Core.Facade.SupplierModule.DataTransferObject.SupplierContractDTO
           @using Resto.CostControl.WebControl.DWZAdapter 
           @using Resto.CostControl.Common.Consts
<div class="pageContent">
    @using (Html.DWZBeginForm())
    { 
        <div class="pageFormContent" layouth="56">
            @Html.HiddenFor(model => model.ID)
            @Html.DWZTextBoxFor(model => model.Code).Required()
            
            @Html.DWZDropDownListFor(model => model.SupplierId, DataSourceConsts.String_Supplier_Code).Required()
            @Html.DWZDateFor(model => model.BeginDate).Required()
            @Html.DWZDateFor(model => model.EndDate).Required()
            <div class="divider">
            </div>
            <div class="tabs">
            <div class="tabsContent" style="height: 260px;">
                <table class="list nowrap itemDetail" addbutton="增加品名"  width="95%">
                    <thead>
                        <tr>
                            <th type="lookup" name="dwz.items[#index#].MaterialId" size="8" lookupgroup="items[#index#]" 
                            lookupurl="@Url.Action("LookupMaterial", "Material")"  fieldclass="required">
                                品名
                            </th>
                            <th type="text" name="dwz.items[#index#].Price" size="15" fieldclass="required">
                                价格
                            </th>
                            <th type="del" width="25">
                                <hi:text key="操作" />
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @for (int index = 0; index < Model.Items.Length; index++)
                        {
                            Resto.CostControl.Core.Facade.SupplierModule.DataTransferObject.SupplierContractItemDTO item = Model.Items[index];
                            <tr class="unitBox">
                                <td>
                                    @Html.Hidden("dwz.items[" + index + "].MaterialId", item.MaterialId)
                                    @Html.TextBox("dwz.items[" + index + "].Material", item.Material.Name, new { size = "15" })
                                <a title="查找带回" lookupgroup="items[@index]" lookupurl="@Url.Action("LookupMaterial", "Material")" class="btnLook">
                                    查找带回</a>
                                </td>
                                <td>
                                    @Html.TextBox("dwz.Items[" + index + "].Price", item.Price, new { size = "15" })
                                </td>
                                <td>
                                    <a href="@Url.Action("DeleteItem")/@item.MaterialId" class="btnDel" title="您确定要删除服务端的记录吗?">删除</a>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            </div>
        </div>
        @Html.DWZFormBar()
    }
</div>
